package C042;

/**
 * ClassName: C03
 * Package: C042
 * Description:
 *
 * @Author BCXJ
 * @Create 2025/2/2 22:00
 * @Version 1.0
 * @Since 1.0
 */
public class C03 {
    public static void main(String[] args) {
        for (int i = 0; i < 150; i++) {
            if(! (process(i) == process2(i))) {
                System.out.println("error");
                return;
            }
            System.out.println(i + ": " + process(i));
        }
    }


    public static boolean process(int num) {
        int addRes = 0;
        int jian = 1;
        for (int i = 1; i < num; i++) {
            addRes += i;
            while (addRes > num) {
                addRes -= jian ++;
            }
            if(addRes == num) {
                return true;
            }
        }
        return false;
    }

    public static boolean process2(int num) {
        return (num & (num - 1)) != 0;
    }
}
